local fold = Instance.new('Folder') fold.Parent = workspace fold.Name="TGEN" local X = 50 local Z = 50 local offset = 75 local grid = {} function GenTer(sz,xx,zz,w8) fold:ClearAllChildren() local seed = math.random(1,100000) for x = 1, xx or X do grid[x] = {} for z = 1, zz or Z do grid[x][z] = math.noise((seed + x)/15,z/15) * 15 end end for x = 1, xx or X do wait(w8) for z = 1 ,zz or Z do wait(w8) local yp = grid[x][z] local p = Instance.new('Part') p.Anchored = true p.Locked = true if yp < -3 then p.Material = Enum.Material.Sand p.BrickColor = BrickColor.new('Cool yellow') else p.Material = Enum.Material.Grass p.BrickColor = BrickColor.new('Bright green') end p.Position = Vector3.new(x*sz+offset,yp,z*sz+offset) p.Size = Vector3.new(sz,20,sz) p.Parent = fold end end print('done!') end owner.Chatted:connect(function(m) local args = string.split(m," ") if args[1] == "]gen" then print("generating terrain with following params\n") print('brickwidth: '..(args[2] or 2).."\ngenwidth(x): "..(args[3] or 25).."\ngenwidth(z): "..(args[4] or 25).."\nwait time: "..(args[5] or "no time")) GenTer(tonumber(args[2]) or 2,tonumber(args[3]) or 25, tonumber(args[4]) or 25,tonumber(args[5] or nil)) elseif args[1] == "]clear" then fold:ClearAllChildren() print('clearing folder') elseif args[1] == "]offset" then offset = tonumber(args[2]) print("offset set to "..args[2]) end end)